<?php
// $filter - формируется в контроллере
$model = $filter['model'];
$cityCode = $filter['city_code'];
$types = $filter['types'];
$districts = $filter['districts'];
$metro = $filter['metro'];
?>
<?php $form = $this->beginWidget('CActiveForm', array(
		'id'=>'filter-form',
		//'enableClientValidation'=>true,
		'method'=>'get',
		'clientOptions'=>array(
			'validateOnSubmit'=>true,
		),
		'action' => Yii::app()->createUrl("/catalog/".$cityCode.'/' ),
		//'enableAjaxValidation' => true,
	)); ?>
<div class="search">
	<div class="wfix">
		<table class="tb1">
		<tbody><tr class="f1">
		<td class="td1">
			<div class="t_e"><?php echo $form->label($model,'type'); ?></div>
			<?php $i = 0;  ?>
			<?php  echo $form->checkBoxList($model, 'type', $types, array('separator'=>''));?>
		</td>
		<td class="td2">
			<div class="t_e">Этаж</div>
			с <?php echo $form->textField($model, 'floor_from', array('maxlength'=>'2', 'onkeyup'=>"return proverka(this);"))?> по <?php echo $form->textField($model, 'floor_to', array('maxlength'=>'2', 'onkeyup'=>"return proverka(this);"))?>
		</td>
		<td class="td3">
			<div class="t_e">
				<?php if (count($districts)) { ?>
				<a href="javascript:SwitchTab('sel_1', 'fv_1');" id="sel_1"  class="active">Район</a>
				<?php }?>
				<?php if (count($districts) && count($metro)) { ?>
				&nbsp;|&nbsp;
				<?php } ?>
				<?php if (count($metro)) { ?>
				<a href="javascript:SwitchTab('sel_2', 'fv_2');" id="sel_2">Метро</a>	
				<?php } ?>
			</div>	
			<?php if (count($districts)) { ?>
			<div id="fv_1" >
				<?php echo $form->dropDownList( $model, 'district_id', $districts, array('prompt'=>'Выбрать'));?>
			</div>
			<?php } ?>
			<?php if (count($metro)) { ?>
			<div id="fv_2" style="display:none;">
				<?php echo $form->dropDownList( $model, 'metro_id', $metro, array('prompt'=>'Выбрать'));?>
			</div>	
			<?php } ?>
		</td>
		<td class="td4">
			<div class="t_e"><?php echo $form->label($model,'cost'); ?></div>
			от <?php echo $form->textField($model, 'cost_from', array('onkeyup'=>"return proverka(this);"))?> до <?php echo $form->textField($model, 'cost_to', array('onkeyup'=>"return proverka(this);"))?>
		</td>
		</tr>
		</tbody></table>	
		<hr>
		<table class="tb2">
		<tbody><tr>
		<td id="v0">
			<?php echo $form->checkBox($model,'furniture'); ?>
			<?php echo $form->label($model,'furniture'); ?>	
		</td>
		<td id="v1">
			<?php echo $form->checkBox($model,'cooker'); ?>
			<?php echo $form->label($model,'cooker'); ?>	
		</td>
		<td id="v2">
			<?php echo $form->checkBox($model,'wash_machine'); ?>
			<?php echo $form->label($model,'wash_machine'); ?>	
		</td>
		<td id="v3">
			<?php echo $form->checkBox($model,'fridge'); ?>
			<?php echo $form->label($model,'fridge'); ?>	
		</td>
		<td id="v4">
			<?php echo $form->checkBox($model,'without_photo'); ?>
			<?php echo $form->label($model,'without_photo'); ?>	
		</td>
		<td id="v5">
			<?php echo $form->checkBox($model,'only_new'); ?>
			<?php echo $form->label($model,'only_new'); ?>	
		</td>
		</tr>
		</tbody></table>	
	</div>
	<div class="seb">
		<?php echo CHtml::submitButton('Найти'); ?>
	</div>
</div>
<?php $this->endWidget(); ?>